package com.tedu.jiaodanote.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.tedu.jiaodanote.entry.Note;
import com.tedu.jiaodanote.mapper.NoteMapper;
import com.tedu.jiaodanote.service.NoteService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author：毕龙
 * Date: 2024/7/8 14:36
 */
@Service
public class NoteServiceImpl  implements NoteService {

    @Autowired
    private NoteMapper noteMapper;

    @Override
    public List<Note> listNote() {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.orderByDesc("ctime");
        return noteMapper.selectList(wrapper);
    }

    @Override
    public int save(Note note) {
        Note noteInsert = new Note();
        BeanUtils.copyProperties(note, noteInsert);
        int insert = noteMapper.insert(noteInsert);
        return insert;
    }

    @Override
    public int updateById(Note note) {
        return 0;
    }

    @Override
    public int removeById(Long noteid) {
        return 0;
    }
}
